---
title: "getChannel"
description: "The `HotUpdater.getChannel()` function retrieves the current release channel of the app. This is useful when you want to determine which channel updates are being applied from."
icon: Radio
---

By default, if no channel is specified, the app is assigned to the `production` channel.

For more details about channels, refer to the [Channel Guide](/docs/guides/channel-management).

## Usage

You can use `HotUpdater.getChannel()` to dynamically check the release channel in your application logic.

### Example

```tsx
import { HotUpdater } from "@hot-updater/react-native";
import { Text, View } from "react-native";

function App() {
  const channel = HotUpdater.getChannel();

  return (
    <View>
      <Text>Current Channel: {channel}</Text>
    </View>
  );
}

export default HotUpdater.wrap({
  baseURL: "<your-update-server-url>",
  updateStrategy: "appVersion", // or "fingerprint"
  updateMode: "auto",
  requestHeaders: {
    "Authorization": "Bearer <your-access-token>",
  },
})(App);
```

## Behavior

- If `releaseChannel` is set in `hot-updater.config.ts`, `HotUpdater.getChannel()` returns that value.
- If no channel is set, the default is `production`.
- Channels help separate environments such as `dev`, `staging`, and `production`, ensuring that updates are applied correctly.
- The initial channel is injected into the native app during the build process based on the `releaseChannel` specified in `hot-updater.config.ts`.
- After the app is built, updates can be deployed to the correct channel using `hot-updater deploy -c <channel>`, such as `hot-updater deploy -c production` or `hot-updater deploy -c dev`.
- **Important**: Channel changes require rebuilding the native app to take effect. Simply changing the channel in the configuration file or through deployment commands will not update the channel of an already built app.
- **It is crucial to set the correct channel during the initial build**, as the app will continue to receive updates only from that specified channel.

## Configuration Example (`hot-updater.config.ts`)

```tsx
import { defineConfig } from "hot-updater";
import { config } from "dotenv";

config({ path: ".env.hotupdater" });

export default defineConfig({
  releaseChannel: "dev", // Specifying the release channel
  build: ...,
  storage: ...,
  database: ...,
});
```

With this configuration, `HotUpdater.getChannel()` will return `"dev"`. This ensures that all future updates are correctly applied to the `dev` channel.
